<template>
	<view class="topBar">
		<u-icon @click='toBack' class="top-arrow" name="arrow-left"></u-icon>
		<view class="top-left" :style="{backgroundImage:'url('+url+')'}">登入：{{name}}垃圾焚烧厂</view>
		<view class="top-right" :style="{backgroundImage:'url('+url+')'}">{{title}}</view>
	</view>
</template>

<script>
	export default {
		name: 'myTopBar',
		props: {
			title: String,
			url: String
		},
		data() {
			return {
				name:""
			}
		},
		mounted() {
			this.selectName()
		},
		methods: {
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			/* 查询工厂名称 */
			async selectName(){
				const res=await this.$u.api.selectName()
				this.name=res.body.data
			}
		}
	}
</script>

<style>
	.topBar {
		display: flex;
		align-items: center;
		width: 100%;
		height: 60rpx;
		margin-top: 10rpx;
		background-color: #2169D3;
	}

	.top-arrow {
		color: #FFFFFF;
		margin: 0 4rpx;
	}

	.top-left,
	.top-right {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 240rpx;
		height: 45rpx;
		background-size: 100% 100%;
		font-size: 20rpx;
		color: #FFFFFF;
	}

	.top-right {
		width: 420rpx;
	}
</style>
